package com.kkb.service;
import com.kkb.mapper.AdminroleMapper;
import com.kkb.mapper.AdminsMapper;
import com.kkb.pojo.Adminrole;
import com.kkb.pojo.Admins;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class AdminsService {
    @Resource
    private AdminsMapper adminsMapper;
    @Resource
    private AdminroleMapper adminroleMapper;
    /**
     * 通过id去查询Admins
     */
    public Admins queryById(Integer adminId){
        Admins admins = adminsMapper.selectByPrimaryKey(adminId);
        if (admins!=null){
            Integer roleId = admins.getRoleId();
            Adminrole adminrole = adminroleMapper.selectByPrimaryKey(roleId);
            admins.setAdminrole(adminrole);
        }
        return admins;
    }
}
